package com.howtoplay.gateserver.Controller;


import Bean.User;
import com.anoyi.grpc.GrpcClient;
import com.anoyi.grpc.service.CommonService;
import com.howtoplay.gateserver.Bean.Response;
import com.howtoplay.gateserver.RabbitMq.RabbiteSender;
import com.howtoplay.gateserver.Service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping(value = "/login")
public class LoginController {

    @Autowired
    RabbiteSender sender;

    @Autowired
    HelloService helloService;

    @RequestMapping(value = "/testLogin",method = RequestMethod.GET)
    public Response testLogin(@RequestParam Map<String, String> map){
        System.out.println("login--->"+map.get("name"));
        User u = helloService.testRpc("447004425489879040");
        System.out.println(u.toString());
        return Response.SuccessResonse(u);
    }

    @RequestMapping(value = "/testLogin2",method = RequestMethod.GET)
    public Response testLogin2(@RequestParam Map<String, String> map){
        System.out.println("login--->"+map.get("name"));
        return Response.SuccessResonse(helloService.sayHello());
    }
}
